home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr42
/
vocshow2.zip
/
VOC_PC.PKG
< prev
next >
Wrap
Text File
|
1993-06-08
|
2KB
|
65 lines
-- Copyright 1992 by Tom Moran. May be used by anyone for any purpose.
with Calendar,
Compress,
PC_Sound,
Rtext_Io,
SB_Samples;
package body Voc_PC is
function "=" (Left,Right : in Voc_Data.Block_Types) return Boolean
renames Voc_Data."=";
function "=" (Left,Right : in Voc_Data.Pack_Types) return Boolean
renames Voc_Data."=";
procedure Play(Voc_Block: in out Voc_Data.Blocks) is
begin
if Voc_Block.Block_Type = Voc_Data.Silence then
declare
-- poll for key press for appropriate duration
use Calendar;
Time_To_Stop: constant Calendar.Time
:= Calendar.Clock + Voc_Block.Silence_Interval;
begin
while Calendar.Clock < Time_To_Stop loop
exit when Rtext_Io.Keypress;
end loop;
end;
return;
end if;
if Voc_Block.Block_Type /= Voc_Data.Voice_Data then
return;
end if;
PC_Sound.Set_Sample_Rate(Voc_Block.Sample_Rate);
case Voc_Block.Packing is
when Voc_Data.Unpacked =>
declare
Packed_Sound:SB_Samples.Packed_Sounds(1 .. Voc_Block.Block_Length/2);
begin
Compress.Pack(Voc_Block.Unpacked_Sound
(Voc_Block.Unpacked_Sound'First)'Address,
Voc_Block.Block_Length,
Packed_Sound);
PC_Sound.Playback(Packed_Sound(1)'Address,Voc_Block.Block_Length/2);
end;
when Voc_Data.Halved =>
PC_Sound.Playback(Voc_Block.Packed_Sound
(Voc_Block.Packed_Sound'First)'Address,
Voc_Block.Block_Length);
when Voc_Data.Thirds =>
-- this will sound like noise since we don't know how to unpack it
PC_Sound.Playback(Voc_Block.Packed3_Sound
(Voc_Block.Packed3_Sound'First)'Address,
(Voc_Block.Block_Length/2)*3);
when Voc_Data.Quartered =>
-- this will sound like noise since we don't know how to unpack it
PC_Sound.Playback(Voc_Block.Packed4_Sound
(Voc_Block.Packed4_Sound'First)'Address,
(Voc_Block.Block_Length/2)*4);
end case;
end Play;
end Voc_PC;